<template>
    <div class="qrcode-wrapper">
        <centerHeader/>

        <div class="qrcode-wrap">
            <div class="top-wrap">
                <div class="title_box">
                    <span class="title-01">我的顾客</span>
                    <i class="el-icon-arrow-down"></i>
                </div>
            </div>
            <div class="commission">

                <div class="com_list">
                    <el-form  :model="formData" label-width="80px">
                        <el-form-item label="姓名">
                            <el-input type="text" v-model="formData.username"></el-input>
                        </el-form-item>

                        <el-form-item label="电话">
                            <el-input type="text" v-model="formData.mobile"></el-input>
                        </el-form-item>
                        <el-form-item label="密码">
                            <el-input type="password" v-model="formData.password"></el-input>
                        </el-form-item>
                        <div class="submit-box">
                            <button class="submit-btn" @click="submit">保存</button>
                        </div>
                    </el-form>


                </div>
            </div>

        </div>

        <centerFooter/>
    </div>
</template>

<script type="text/ecmascript-6">
    import centerHeader from "@/views/center/components/centerHeader";
    import centerFooter from "@/views/center/components/centerFooter";
    import constant from "@/utils/constant.js";
    // 引用API文件
    import http from "@/utils/http.js";

    import QRCode from "qrcode";

    export default {
        name: "qrcode",
        data() {
            return {
                user_info: {},
                value1: '',
                value2: '',
                formData: {
                    username:"",
                    mobile:"",
                    password:""
                },
                user_list:[]
            };
        },
        components: {
            centerHeader,
            centerFooter
        },
        methods: {
            userinfo() {
                http.get(this, {
                    url: "ucenter/user_info",
                    data: {
                        token: localStorage.getItem("user_token")
                    },
                    dataType: "json",
                    success: function(data) {
                        console.log("用户信息:", data);
                        if (data.status == 1) {
                            this.user_info = data.info;

                            // 获取页面的canva
                        } else {
                        }
                    }
                });
            },
            submit(){
                http.post(this, {
                    url: "passport/register",
                    data: {
                        token: localStorage.getItem("user_token"),
                        store_id:this.user_info.store_id,
                        store_uid:this.user_info.store_uid,
                        user_type:this.user_info.user_type,
                        ...this.formData
                    },
                    dataType: "json",
                    success: function(data) {
                        if(data.status == 1){
                            this.$message.success('添加顾客成功')
                        }else{
                            this.$message.error(data.info);
                        }

                    }
                })
            }
        },
        created() {},
        activated() {
            this.userinfo();
        }
    };
</script>

<style scoped lang="scss">
    .qrcode-wrapper {
    }

    .top-wrap {
        $letHeight: 1.3rem;

        .title-txt {
            height: $letHeight;
            line-height: $letHeight;
            text-align: center;
            background-color: $c-white-light;

            span {
                color: $c-mainC;
                display: inline-block;
                line-height: $letHeight;
                vertical-align: middle;

                &.title-01 {
                    font-size: 0.38rem;
                }
            }
        }
    }

    .main-wrap {
        @extend .cmm-border;
    }

    .img-wrap {
        width: 5rem;
        height: 5rem;
        margin: 0.4rem auto;
        overflow: hidden;
        position: relative;
        padding: 0.22rem;

        .ad-img {
            @extend .cmm-translateXY;
            width: 100%;
        }
    }

    .qrcode-box {
        text-align: center;
        width: 100%;
        .qrcode-txt {
            width: 5.15rem;
            border-radius: 0.8rem;
            background-color: $c-danger;
            font-size: 0.52rem;
            color: $c-white-light;
            $letHeight: 0.6rem;
            height: $letHeight;
            line-height: $letHeight;
            text-align: center;
            margin: 0.48rem auto;
            display: inline-block;
            letter-spacing: 0.1rem;
            font-weight: bold;
        }
    }
    .title-txt-new{
        height:1rem;
        line-height:1rem;
        text-align: center;
        background-color: $c-white-light;
        font-size: 0.32rem;
    }
    .picker{
        padding:0 10px;
        border-top: 0.15rem solid #eeeeee;
        .el-date-editor.el-input, .el-date-editor.el-input__inner{
            width:2.2rem;
        }
        /deep/.el-input__inner{
            border: none;
        }
    }
    .shop_table_header{
        display: flex;
        line-height:1rem;
        padding:0 0.2rem;
        border-bottom:1px solid #eeeeee;
        &>div.th_one{
            flex:2
        }
        &>div.th_two{
            flex:1
        }
    }
    .shop_table_table{
        &>li{
            padding:0.25rem 0.2rem;
            display: flex;
            &>div.td_one{
                flex:2;
                &>div.td_item_one{
                    margin-bottom:0.2rem;
                }
                &>div.td_item_two{
                    &>span{
                        font-size: 0.08rem;
                    }

                }
            }
            &>div.td_two{
                flex:1;
                &>div.td_item_one{
                    margin-bottom:0.2rem;
                }
                &>div.td_item_two{
                    &>span{
                        font-size: 0.08rem;
                    }

                }
            }
        }
    }
    .title_box{
        height: 0.9rem;
        line-height:0.9rem;
        font-size: 0.36rem;
        text-align: center;
    }
    .commission{
        border-top: 0.15rem solid #eeeeee;
        .com_box{
            height: 1rem;
            line-height:1rem;
            padding:0 0.3rem;
            border-bottom:1px solid #eeeeee;
            &>span{
                line-height:1rem;
                display: flex;
                justify-content: center;
            }
        }
    }
    .fl{
        float: left;
    }
    .fr{
        float: right;
    }
    .com_title{
        height: 1rem;
        line-height:1rem;
        text-align: center;
        font-size: 0.36rem;
    }
    .com_ul{
        li{
            padding:0.25rem 0.3rem;
            border-bottom:1px solid #eeeeee;
            .com_top{
                line-height:0.5rem;
                margin-bottom:0.2rem;
            }
            .com_name{
                float: left;
            }
            .com_orderId{
                font-size: 0.2rem!important;
                float: left;
            }
            .com_price{
                font-size: 0.5rem;
                color:#ff4c4c;
                float: right;
            }
            .com_time{
                float: right;
            }
        }
    }
    .com_color{
        font-size: 0.45rem;
        color:#ff4c4c;
    }
    .com_list{
        font-size: 0.3rem!important;
        /deep/.el-tabs__nav-wrap{
            margin:0 0.25rem;
        }
        /deep/.el-tabs__nav{
            width:100%
        }
        /deep/.el-tabs__item{
            width:25%;
            text-align: center;
            height: 1rem;
            line-height:1rem;

        }
        /deep/.el-tabs__item.is-active{
            color: #ff4c4c;
            font-weight: 500;
        }
        /deep/.el-tabs__active-bar{
            background-color:#ff4c4c;
        }
        /deep/.el-tabs__nav-wrap::after{
            background-color: #ffffff;
        }
        /deep/.el-form{
            padding:0 0.5rem;
            margin-bottom:0.6rem;
            .el-form-item{
                border-bottom:0.013333rem solid #dcdfe6;
                margin-top:0.3rem;
            }
            .el-form-item__label{
                text-align: left;
                width:1.2rem!important;
            }
            .el-form-item__content{
                margin-left:1.2rem!important;
                .el-input__inner{
                    border:none;
                }
            }
        }
    }
    .tab_ul{
        li{
            padding:0.25rem;
            border-bottom:1px solid #eeeeee;
        }
        .tab_item_top{
            margin-bottom:0.28rem;
            .tab_item_time{
                float:left;
            }
            .tab_item_type{
                float:right;
            }
        }
    }
    .tab_item_bottom{
        display: flex;
        .tab_item_order{
            flex:1;
            text-align: left;
        }
        .tab_item_cash{
            flex: 1;
            text-align: center;
        }
        .tab_item_timer{
            flex: 1.2;
            text-align: right;
        }
    }
</style>
